/*
 * Copyright (C) 2010 Young, Fey <fey.young@gmail.com>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */

package com.youngfey.ebs

/**
 * Keep track of how long you spend working on each task, so you can go back
 * and see how long things took relative to the estimate.
 * @author Young, Fey <fey.young@gmail.com>
 */
class History {
    /**
     * When you divide estimate by actual, you get velocity: how fast the task
     * was done relative to estimate. 
     */
    final Number velocity
    
    /**
     * As estimators gain more experience, their estimating skills improve, so
     * weight is introduced, weight is a number in the range (0, 1]
     */
    final Number weight
    History(Number velocity, Number weight) {
        assert velocity > 0
        assert weight > 0 && weight <= 1
        this.velocity = velocity
        this.weight = weight
    }

    /**
     * when weight is ommited, it will be set to 1
     */
    History(velocity) {
        this(velocity, 1)
    }

    // For debug only
    @Override
    String toString() {
        "History[$velocity, $weight]"
    }
}

